'use strict'
class treelist{
  constructor (mdb) {
    this.mdb = mdb || null
  }
  async insert(c){
    let data=JSON.parse(c)    
   
      let sql='select * from publish';
      let r=await this.mdb.query(sql);
      let publishid=r['rows'].length+1; 
      this.mdb.connect().then(client=>{
        client.query('insert into publish values($1::int,$2::varchar(50),$3::int,$4::text,$5::text)',[publishid,data.time,data.uid,data.publishcontent,data.publishimg]).then(res=>{
                    
        })
      })
      return '插入数据成功'
  }
}
module.exports = treelist
